package generic.method;

import generic.generator.Coffee;
import generic.generator.CoffeeGenerator;
import generic.generator.Fibonacci;
import generic.generator.Generator;
import utils.Log;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;

public class Generators {


    public static <T> Collection<T> fill(Collection<T> coll, Generator<T> gen, int n) {
        for (int i = 0; i < n; i++) {
            coll.add(gen.next());
        }


        return coll;
    }


    public static void main(String[] args) {
        Collection<Coffee> coffees = fill(new ArrayList<Coffee>(), new CoffeeGenerator(), 4);

        for (Coffee c : coffees) {
            Log.vn(c);
        }

        Collection<Integer> fnumbers = fill(new ArrayList<Integer>(), new Fibonacci(), 12);

        for (int i : fnumbers) {
            Log.vn(i);
        }
    }
 }
